/*
Navicat MySQL Data Transfer

Source Server         : localhost
Source Server Version : 50624
Source Host           : localhost:3306
Source Database       : cloud_notification

Target Server Type    : MYSQL
Target Server Version : 50624
File Encoding         : 65001

Date: 2018-06-17 10:04:40
*/

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for t_sms
-- ----------------------------
DROP TABLE IF EXISTS `t_sms`;
CREATE TABLE `t_sms` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `phone` varchar(16) NOT NULL COMMENT '手机号码',
  `signName` varchar(128) DEFAULT NULL COMMENT '阿里云短信签名',
  `templateCode` varchar(128) DEFAULT NULL COMMENT '阿里云模板code',
  `params` varchar(500) DEFAULT NULL COMMENT '参数',
  `bizId` varchar(128) DEFAULT NULL COMMENT '阿里云返回的',
  `code` varchar(64) DEFAULT NULL COMMENT '阿里云返回的code',
  `message` varchar(128) DEFAULT NULL COMMENT '阿里云返回的',
  `day` date NOT NULL COMMENT '日期（冗余字段,便于统计某天的发送次数）',
  `createTime` datetime NOT NULL COMMENT '创建时间',
  `updateTime` datetime NOT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`),
  KEY `phone` (`phone`),
  KEY `day` (`day`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='发短信记录表';




oracle


CREATE TABLE t_sms (
  id number(11) NOT NULL PRIMARY KEY,
  phone varchar(16) NOT NULL,
  signName varchar(128) DEFAULT NULL,
  templateCode varchar(128) DEFAULT NULL,
  params varchar(500) DEFAULT NULL,
  bizId varchar(128) DEFAULT NULL,
  code varchar(64) DEFAULT NULL,
  message varchar(128) DEFAULT NULL,
  day date NOT NULL,
  createTime date NOT NULL,
  updateTime date NOT NULL
)



comment on table t_sms is '发短信记录表';
comment on column t_sms.phone is '手机号码';
comment on column t_sms.signName is '阿里云短信签名';
comment on column t_sms.templateCode is '阿里云模板code';
comment on column t_sms.params is '参数';
comment on column t_sms.bizId is '阿里云返回的';
comment on column t_sms.code is '阿里云返回的code';
comment on column t_sms.message is '阿里云返回的';
comment on column t_sms.day is '日期（冗余字段,便于统计某天的发送次数）';
comment on column t_sms.createTime is '创建时间';
comment on column t_sms.updateTime is '更新时间';

CREATE SEQUENCE t_sms_seq INCREMENT BY 1 START WITH 1 NOMAXVALUE NOCYCLE NOCACHE;
CREATE OR REPLACE TRIGGER t_sms_TRG
  BEFORE INSERT ON t_sms
  FOR EACH ROW  WHEN (new.id is null)
BEGIN
  SELECT t_sms_seq.NEXTVAL INTO :NEW.id FROM DUAL;
END;